package services.communication.chat._static;

import org.example.www.communication.ChatService.*;

/**
 * La clase es un proxy estatico para acceder al web-service de comunicacion de
 * e-mails.<BR/>
 * <BR/>
 * <BR/>
 * NOTA: La clase fue auto-generada desde el archivo
 * communicationChatService.wsdl.
 */
public class CommunicationChatServiceProxy implements
		CommunicationChatService_PortType {
	
	private String								_endpoint							= null;
	
	private CommunicationChatService_PortType	communicationChatService_PortType	= null;
	
	public CommunicationChatServiceProxy() {
		_initCommunicationChatServiceProxy();
	}
	
	public CommunicationChatServiceProxy(String endpoint) {
		_endpoint = endpoint;
		_initCommunicationChatServiceProxy();
	}
	
	private void _initCommunicationChatServiceProxy() {
		try {
			communicationChatService_PortType = (new CommunicationChatService_ServiceLocator())
					.getcommunicationChatServiceSOAP();
			if (communicationChatService_PortType != null) {
				if (_endpoint != null)
					((javax.xml.rpc.Stub) communicationChatService_PortType)
							._setProperty(
									"javax.xml.rpc.service.endpoint.address",
									_endpoint);
				else
					_endpoint = (String) ((javax.xml.rpc.Stub) communicationChatService_PortType)
							._getProperty("javax.xml.rpc.service.endpoint.address");
			}
			
		} catch (javax.xml.rpc.ServiceException serviceException) {
		}
	}
	
	public String getEndpoint() {
		return _endpoint;
	}
	
	public void setEndpoint(String endpoint) {
		_endpoint = endpoint;
		if (communicationChatService_PortType != null)
			((javax.xml.rpc.Stub) communicationChatService_PortType)
					._setProperty("javax.xml.rpc.service.endpoint.address",
							_endpoint);
		
	}
	
	public CommunicationChatService_PortType getCommunicationChatService_PortType() {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType;
	}
	
	public ChatRoom[] getActiveChatRooms() throws java.rmi.RemoteException {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType.getActiveChatRooms();
	}
	
	public boolean enterChatRoom(String chatRoomID, String userID)
			throws java.rmi.RemoteException {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType.enterChatRoom(chatRoomID,
				userID);
	}
	
	public String sendMsg(String chatRoomID, String userID, String msg)
			throws java.rmi.RemoteException {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType.sendMsg(chatRoomID, userID,
				msg);
	}
	
	public String[] reciveMsgs(String chatRoomID, String userID)
			throws java.rmi.RemoteException {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType.reciveMsgs(chatRoomID, userID);
	}
	
	public boolean quitChatRoom(String chatRoomID, String userID)
			throws java.rmi.RemoteException {
		if (communicationChatService_PortType == null)
			_initCommunicationChatServiceProxy();
		return communicationChatService_PortType.quitChatRoom(chatRoomID,
				userID);
	}
	
}
